<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>行业深度研报</title>
    <style>
        table {
            width: 100%;
            border-collapse: collapse;
        }

        th,
        td {
            border: 1px solid black;
            padding: 1px;
            text-align: left;
        }

        tr:hover {
            /* background-color: #f5f5f5; */
            /* background-color: #ecf5ff !important; */
            background-color: #fbec88;
        }
    </style>
</head>
<script>
    // 时间戳转换为指定格式的日期
    function formatDate(timestamp) {
        const date = new Date(timestamp);
        const year = date.getFullYear();
        const month = String(date.getMonth() + 1).padStart(2, '0');
        const day = String(date.getDate()).padStart(2, '0');
        const hours = String(date.getHours()).padStart(2, '0');
        const minutes = String(date.getMinutes()).padStart(2, '0');
        const seconds = String(date.getSeconds()).padStart(2, '0');

        return `${year}-${month}-${day}  ${hours}:${minutes}:${seconds}`;
    }

    // 限制报告名称的长度并更新日期格式
    <!-- function updateTable() {
        const rows = document.querySelectorAll('tbody tr');
        rows.forEach(row => {
            const titleCell = row.cells[2];
            const dateCell = row.cells[3];

            // 限制报告名称的长度
            const title = titleCell.textContent;
            if (title.length > 50) {
                titleCell.textContent = title.slice(0, 50) + '...';
            }

            // 更新日期格式
            const timestamp = parseInt(dateCell.textContent, 10);
            dateCell.textContent = formatDate(timestamp);
        });
    } -->

    // 页面加载完成后执行updateTable函数
    window.addEventListener('DOMContentLoaded', updateTable);
</script>

<body>
    <div>
        <div>
            <h1>Header</h1>
        </div>
        <div>
            <h1>Body</h1>
            <table>
                <thead>
                    <tr>
                        <th>日期</th>
                        <th>行业</th>
                        <th>标题</th>
                        <th>页数</th>
                        <th>大小</th>
                        <!-- <th>机构</th> -->
                        <!-- <th>作者</th> -->
                    </tr>
                </thead>
                <tbody>
                    {% for item in data %}
                    <tr>
                        <td><a href="./" target="_blank">{{ item.reportDate.strftime('%Y-%m-%d') }}</a></td>
                        <td><a href="./deep" target="_blank">{{ item.industry }}</a></td>
                        <td><a href="{{ item.file_url }}" target="_blank">{{ item.title }}</a></td>
                        <td>{{ item.file_size }}</td>
                        <td>{{ item.file_pagenum }}</td>
                        <!-- <td><a href="./" target="_blank">机构</a></td> -->
                        <!-- <td><a href="./" target="_blank">作者</a></td> -->
                    </tr>
                    {% endfor %}
                </tbody>
            </table>
        </div>
        <div>
            <h1>Footer</h1>
            <h1>共{{pages}}页</h1>
            <h1>
                <a href="/deep/?page={{page-1}}" <<上一页></a>
                <span>第{{page}}页</span>
                <a href="/deep/?page={{page+1}}">下一页>></a>
            </h1>

        </div>
    </div>
</body>

</html>